using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using DukeyCssFetch.api;
using DukeyCssFetch.auth.mou18.com;
using DukeyCssFetch.Properties;

namespace DukeyCssFetch
{
	// Token: 0x02000016 RID: 22
	public class Register : Form
	{
		// Token: 0x060000F3 RID: 243 RVA: 0x0000F1E8 File Offset: 0x0000D3E8
		public Register(string signkey)
		{
			this.string_0 = "";
			
			this.InitializeComponent();
			this.string_0 = signkey;
			this.txtSignKey.Text = signkey;
			this.txtEmail.Text = Settings.Default.email;
			this.txtRegKey.Text = Settings.Default.regkey;
		}

		// Token: 0x060000F5 RID: 245 RVA: 0x0000F270 File Offset: 0x0000D470
		private void button1_Click(object sender, EventArgs e)
		{
			this.button1.Enabled = false;
			this.button1.Text = "正在注册...";
			if (this.txtRegKey.Text.Trim() == Comm.api.Encrypt(this.string_0))
			{
				try
				{
					string text = this.txtEmail.Text.Trim();
					text = text.Replace(".", "-");
					if (string.IsNullOrEmpty(text))
					{
						MessageBox.Show("请输入购买时的email账号!");
						this.button1.Enabled = true;
						return;
					}
					string empty = string.Empty;
					dukeyauth dukeyauth = new dukeyauth();
					string a = dukeyauth.AuthUser(text, this.string_0, this.txtRegKey.Text.Trim(), "2015-2-17", ref empty, 280);
					if (a == "expire")
					{
						base.Hide();
						if (DialogResult.Yes == MessageBox.Show("你的产品已超过使用期,现在去续费吗", "温馨提示", MessageBoxButtons.YesNo))
						{
							Process.Start(string.Format("http://www.mou18.com/xufee_{0}^{1}.html", text, this.string_0));
						}
						Environment.Exit(0);
					}
					else if (a == "nouser")
					{
						MessageBox.Show("没有查询到该账户的授权信息,请购买,或者联系qq:1902976602");
						this.button1.Enabled = true;
						return;
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show("获取账户失败,请联系qq:1902976602 " + ex.Message);
					return;
				}
				base.DialogResult = DialogResult.OK;
				Settings.Default.regkey = this.txtRegKey.Text.Trim();
				Settings.Default.email = this.txtEmail.Text.Trim();
				Settings.Default.Save();
				MessageBox.Show("注册成功,请重新启动软件!");
				Environment.Exit(0);
				return;
			}
			MessageBox.Show("注册码不正确!");
			Environment.Exit(0);
			this.button1.Enabled = true;
		}

		// Token: 0x060000F6 RID: 246 RVA: 0x0000F450 File Offset: 0x0000D650
		private void button2_Click(object sender, EventArgs e)
		{
			this.txtSignKey.SelectAll();
			this.txtSignKey.Copy();
		}

		// Token: 0x060000FB RID: 251 RVA: 0x0000F4B8 File Offset: 0x0000D6B8
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}

		// Token: 0x060000FC RID: 252 RVA: 0x0000F4D8 File Offset: 0x0000D6D8
		private void InitializeComponent()
		{
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Register));
			this.txtRegKey = new TextBox();
			this.label2 = new Label();
			this.linkLabel1 = new LinkLabel();
			this.label3 = new Label();
			this.button1 = new Button();
			this.label4 = new Label();
			this.txtSignKey = new TextBox();
			this.button2 = new Button();
			this.txtEmail = new TextBox();
			this.label1 = new Label();
			this.linkLabel2 = new LinkLabel();
			this.groupBox1 = new GroupBox();
			this.linkLabel3 = new LinkLabel();
			this.label6 = new Label();
			this.linkLabel4 = new LinkLabel();
			this.linkLabel5 = new LinkLabel();
			this.groupBox1.SuspendLayout();
			base.SuspendLayout();
			this.txtRegKey.Location = new Point(16, 104);
			this.txtRegKey.Name = "txtRegKey";
			this.txtRegKey.Size = new Size(331, 21);
			this.txtRegKey.TabIndex = 1;
			this.label2.AutoSize = true;
			this.label2.Location = new Point(14, 88);
			this.label2.Name = "label2";
			this.label2.Size = new Size(95, 12);
			this.label2.TabIndex = 2;
			this.label2.Text = "直接输入注册码:";
			this.linkLabel1.AutoSize = true;
			this.linkLabel1.Location = new Point(14, 152);
			this.linkLabel1.Name = "linkLabel1";
			this.linkLabel1.Size = new Size(149, 12);
			this.linkLabel1.TabIndex = 3;
			this.linkLabel1.TabStop = true;
			this.linkLabel1.Text = "没有注册码?点此自助购买!";
			this.linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.VbRqJaXoHr);
			this.label3.AutoSize = true;
			this.label3.ForeColor = SystemColors.ControlDarkDark;
			this.label3.Location = new Point(182, 152);
			this.label3.Name = "label3";
			this.label3.Size = new Size(245, 12);
			this.label3.TabIndex = 4;
			this.label3.Text = "如果支付遇到问题,请联系作者qq:1902976602\r\n";
			this.button1.Location = new Point(353, 103);
			this.button1.Name = "button1";
			this.button1.Size = new Size(75, 23);
			this.button1.TabIndex = 5;
			this.button1.Text = "点此注册";
			this.button1.UseVisualStyleBackColor = true;
			this.button1.Click += new EventHandler(this.button1_Click);
			this.label4.AutoSize = true;
			this.label4.Location = new Point(14, 53);
			this.label4.Name = "label4";
			this.label4.Size = new Size(47, 12);
			this.label4.TabIndex = 2;
			this.label4.Text = "机器码:";
			this.txtSignKey.Location = new Point(67, 48);
			this.txtSignKey.Name = "txtSignKey";
			this.txtSignKey.Size = new Size(201, 21);
			this.txtSignKey.TabIndex = 1;
			this.button2.Location = new Point(272, 47);
			this.button2.Name = "button2";
			this.button2.Size = new Size(75, 23);
			this.button2.TabIndex = 5;
			this.button2.Text = "复制机器码";
			this.button2.UseVisualStyleBackColor = true;
			this.button2.Click += new EventHandler(this.button2_Click);
			this.txtEmail.Location = new Point(67, 12);
			this.txtEmail.Name = "txtEmail";
			this.txtEmail.Size = new Size(201, 21);
			this.txtEmail.TabIndex = 1;
			this.label1.AutoSize = true;
			this.label1.Location = new Point(14, 17);
			this.label1.Name = "label1";
			this.label1.Size = new Size(41, 12);
			this.label1.TabIndex = 2;
			this.label1.Text = "Email:";
			this.linkLabel2.AutoSize = true;
			this.linkLabel2.LinkColor = Color.Red;
			this.linkLabel2.Location = new Point(215, 131);
			this.linkLabel2.Name = "linkLabel2";
			this.linkLabel2.Size = new Size(221, 12);
			this.linkLabel2.TabIndex = 7;
			this.linkLabel2.TabStop = true;
			this.linkLabel2.Text = "我已购买,需要重新注册?点此找回注册码";
			this.linkLabel2.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
			this.groupBox1.Controls.Add(this.linkLabel3);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Location = new Point(12, 167);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(427, 68);
			this.groupBox1.TabIndex = 8;
			this.groupBox1.TabStop = false;
			this.linkLabel3.AutoSize = true;
			this.linkLabel3.Location = new Point(377, 41);
			this.linkLabel3.Name = "linkLabel3";
			this.linkLabel3.Size = new Size(53, 12);
			this.linkLabel3.TabIndex = 30;
			this.linkLabel3.TabStop = true;
			this.linkLabel3.Text = "服务条款";
			this.linkLabel3.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
			this.label6.AutoSize = true;
			this.label6.ForeColor = SystemColors.ControlDarkDark;
			this.label6.Location = new Point(9, 17);
			this.label6.Name = "label6";
			this.label6.Size = new Size(419, 36);
			this.label6.TabIndex = 6;
			this.label6.Text = "本软件已申请知识产权保护,任何个人非法使用、传播、兜售、破解我司将保留\r\n\r\n追究的权利! 官方为唯一合法购买途径,没有任何代理,请勿上当受骗!";
			this.linkLabel4.AutoSize = true;
			this.linkLabel4.Location = new Point(274, 17);
			this.linkLabel4.Name = "linkLabel4";
			this.linkLabel4.Size = new Size(77, 12);
			this.linkLabel4.TabIndex = 30;
			this.linkLabel4.TabStop = true;
			this.linkLabel4.Text = "观看视频教程";
			this.linkLabel4.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked);
			this.linkLabel5.AutoSize = true;
			this.linkLabel5.LinkColor = Color.FromArgb(255, 128, 128);
			this.linkLabel5.Location = new Point(357, 17);
			this.linkLabel5.Name = "linkLabel5";
			this.linkLabel5.Size = new Size(53, 12);
			this.linkLabel5.TabIndex = 38;
			this.linkLabel5.TabStop = true;
			this.linkLabel5.Text = "报名培训";
			this.linkLabel5.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel5_LinkClicked);
			base.AutoScaleDimensions = new SizeF(6f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(451, 240);
			base.Controls.Add(this.linkLabel5);
			base.Controls.Add(this.linkLabel4);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.linkLabel2);
			base.Controls.Add(this.button2);
			base.Controls.Add(this.button1);
			base.Controls.Add(this.label3);
			base.Controls.Add(this.linkLabel1);
			base.Controls.Add(this.label1);
			base.Controls.Add(this.label4);
			base.Controls.Add(this.label2);
			base.Controls.Add(this.txtEmail);
			base.Controls.Add(this.txtSignKey);
			base.Controls.Add(this.txtRegKey);
			base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "Register";
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "软件注册                            请记住官方唯一网站→www.mou18.com";
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			base.ResumeLayout(false);
			base.PerformLayout();
		}

		// Token: 0x060000F7 RID: 247 RVA: 0x0000F468 File Offset: 0x0000D668
		private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			Process.Start("http://www.mou18.com/registercode_" + this.string_0 + ".html");
		}

		// Token: 0x060000F9 RID: 249 RVA: 0x0000F498 File Offset: 0x0000D698
		private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			Process.Start("http://www.mou18.com/agreement.html");
		}

		// Token: 0x060000F8 RID: 248 RVA: 0x0000F488 File Offset: 0x0000D688
		private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			Process.Start("http://www.tudou.com/programs/view/Hz_VRthKx5Y/");
		}

		// Token: 0x060000FA RID: 250 RVA: 0x0000F4A8 File Offset: 0x0000D6A8
		private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			Process.Start("http://www.mou18.com/product/fzgs/lesson.html");
		}

		// Token: 0x060000F4 RID: 244 RVA: 0x0000F250 File Offset: 0x0000D450
		private void VbRqJaXoHr(object sender, LinkLabelLinkClickedEventArgs e)
		{
			Process.Start("http://www.mou18.com/signkey_" + this.string_0 + ".html");
		}

		// Token: 0x04000147 RID: 327
		private Button button1;

		// Token: 0x0400014A RID: 330
		private Button button2;

		// Token: 0x0400014E RID: 334
		private GroupBox groupBox1;

		// Token: 0x04000142 RID: 322
		private IContainer icontainer_0;

		// Token: 0x0400014C RID: 332
		private Label label1;

		// Token: 0x04000144 RID: 324
		private Label label2;

		// Token: 0x04000146 RID: 326
		private Label label3;

		// Token: 0x04000148 RID: 328
		private Label label4;

		// Token: 0x0400014F RID: 335
		private Label label6;

		// Token: 0x04000145 RID: 325
		private LinkLabel linkLabel1;

		// Token: 0x0400014D RID: 333
		private LinkLabel linkLabel2;

		// Token: 0x04000150 RID: 336
		private LinkLabel linkLabel3;

		// Token: 0x04000151 RID: 337
		private LinkLabel linkLabel4;

		// Token: 0x04000152 RID: 338
		private LinkLabel linkLabel5;

		// Token: 0x04000141 RID: 321
		private string string_0;

		// Token: 0x0400014B RID: 331
		private TextBox txtEmail;

		// Token: 0x04000143 RID: 323
		private TextBox txtRegKey;

		// Token: 0x04000149 RID: 329
		private TextBox txtSignKey;
	}
}
